Python Parallel Programming Cookbook by 2015
Author:2015
Language: eng
Format: epub, mobi
Publisher: Packt Publishing
In the main program, we execute the task that will be performed in a sequential mode:
if __name__ == "__main__": for item in number_list: evaluate_item(item)
Also, in a parallel mode, we will use the concurrent.futures module's pooling capability for a thread pool:
with concurrent.futures.ThreadPoolExecutor(max_workers=5)\ as executor: for item in number_list: executor.submit(evaluate_item, item)
The ThreadPoolExecutor executes the given task using one of its internally pooled threads. It manages five threads working on its pool. Each thread takes a job out from the pool and executes it. When the job is executed, it takes the next job to be processed from the thread pool.
When all the jobs are processed, the execution time is printed:
print ("Thread pool execution in " + \ str(time.clock() - start_time_1), "seconds")
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
The Mikado Method by Ola Ellnestam Daniel Brolund(20293)
Hello! Python by Anthony Briggs(19621)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(17890)
Dependency Injection in .NET by Mark Seemann(17855)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(17298)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(17208)
Adobe Camera Raw For Digital Photographers Only by Rob Sheppard(16928)
Kotlin in Action by Dmitry Jemerov(16849)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(15991)
Grails in Action by Glen Smith Peter Ledbrook(15158)
Sass and Compass in Action by Wynn Netherland Nathan Weizenbaum Chris Eppstein Brandon Mathis(13111)
Secrets of the JavaScript Ninja by John Resig & Bear Bibeault(11266)
A Developer's Guide to Building Resilient Cloud Applications with Azure by Hamida Rebai Trabelsi(10576)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(10312)
Jquery UI in Action : Master the concepts Of Jquery UI: A Step By Step Approach by ANMOL GOYAL(9279)
Hit Refresh by Satya Nadella(9071)
The Kubernetes Operator Framework Book by Michael Dame(8520)
Exploring Deepfakes by Bryan Lyon and Matt Tora(8343)
Robo-Advisor with Python by Aki Ranin(8288)